package com.eiisan.web.mapper;

import com.eiisan.web.model.domain.PaymentTransaction;
import org.apache.ibatis.annotations.*;

public interface PaymentTransactionMapper {
	@Options(useGeneratedKeys = true, keyProperty = "id")
	@Insert("INSERT INTO `payment_transaction` VALUES (null, #{payAmount}, '0', #{userId}, #{orderId}, null, null, now(), null, null, #{paymentId}, now());")
    int insertPaymentTransaction(PaymentTransaction paymentTransaction);

	@Select("SELECT ID AS ID ,pay_Amount AS payAmount,payment_Status AS paymentStatus,user_ID AS userId, order_Id AS orderId , created_Time as createdTime ,partypay_Id as partyPayId , payment_Id as paymentId FROM payment_transaction WHERE PAYMENT_ID=#{paymentId};")
	PaymentTransaction selectByPaymentId(String paymentId);

	@Select("SELECT ID AS ID ,pay_Amount AS payAmount,payment_Status AS paymentStatus,user_ID AS userId, order_Id AS orderId , created_Time as createdTime ,partypay_id as partyPayId , payment_id as paymentId FROM payment_transaction WHERE ID=#{id};")
    PaymentTransaction selectById(Long id);

	@Update("update payment_transaction SET PAYMENT_STATUS=#{paymentStatus}  WHERE PAYMENT_ID=#{paymentId};")
	int updatePaymentStatus(@Param("paymentStatus") String paymentStatus, @Param("paymentId") String paymentId);

}
